package com.cattest.cattest.controller;

import com.cattest.cattest.service.CatFunctionService;
import com.sml.aop.cat.CatUrlAnnotation;
import javax.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author linlx
 * @Date 2021/8/22 15:35
 * @Description
 **/
@RestController
public class CatFunctionController {

  @Resource
  private CatFunctionService catFunctionService;

  @GetMapping("/test/transaction")
  public String transaction() {
    return catFunctionService.transaction();
  }

  @GetMapping("/test/catMethodAnnotation")
  public String catAnnotation() {
    for (int i = 0; i < 10; i++) {
      catFunctionService.catMethodAnnotation();
    }
    return "ok";
  }

  @GetMapping("/test/catUrlAnnotation")
  @CatUrlAnnotation
  public String catUrlAnnotation() {
    return "ok";
  }

}
